<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Minim : : Summer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body> 
<center>
<table class="mainTable">
  <tr>
    <td class="header">
    	<span class="indexheader">Minim</span><br/>
    	<span class="indexnavigation">
    		<a href="index.html">core</a> | 
    		<a href="index_ugens.html">ugens</a> | 
    		<a href="index_analysis.html">analysis</a>
    	</span>
    </td>
    <td class="border-left">&nbsp;</td>
  </tr>
  
  <tr>
    <td class="classNavigation">
    	<p class="mainTextName">Summer</p>
    	
    	
       <p class="linkListHeader">Methods</p>
       <p class="linkList">
           
    <a href="summer_method_channelcount.html" title="Returns the number of channels this UGen has been configured to generate.">channelCount ( )</a><br/>
    
    <a href="summer_method_generate.html" title="Generates a buffer of samples by ticking this UGen mono.length times.
 Like the tick method, this will result in all of the">generate ( )</a><br/>
    
    <a href="summer_method_getlastvalues.html" title="Return the last values generated by this UGen. This will most often be
 used by sub-classes when pulling data from their inputs.">getLastValues ( )</a><br/>
    
    <a href="summer_method_patch.html" title="Send the output of this UGen to another UGen, UGenInput, or AudioOutput.">patch ( )</a><br/>
    
    <a href="summer_method_printinputs.html" title="Prints all inputs connected to this UGen (for debugging)">printInputs ( )</a><br/>
    
    <a href="summer_method_samplerate.html" title="Returns the sample rate of this UGen.">sampleRate ( )</a><br/>
    
    <a href="summer_method_setchannelcount.html" title="Let this UGen know how many channels of audio you will be asking it for.">setChannelCount ( )</a><br/>
    
    <a href="summer_method_setsamplerate.html" title="Set the sample rate for this UGen.">setSampleRate ( )</a><br/>
    
    <a href="summer_method_tick.html" title="Generates one sample frame for this UGen.">tick ( )</a><br/>
    
    <a href="summer_method_unpatch.html" title="Unpatch this UGen from an AudioOutput or other UGen.">unpatch ( )</a><br/>
    
	   </p>
   
    </td>
    <td class="mainText border-left">
    	A Summer allows you to sum the outputs of multiple UGens to be sent further
 down the chain. Unlike most UGen effects, you can patch more than one UGen to
 a Summer.
    	<p class="memberSectionHeader">Constructors</p>
    	<pre><em>Constructs a Summer that you can patch multiple UGens to.</em>
Summer()
</pre>
    	
    	<p class="memberSectionHeader">Related</p>
    	
    	<p class="memberSectionHeader">Example</p>
    	<pre>/**
  * This sketch demonstrates how to patch more than one UGen
  * to a Summer. It works just like patching any other two 
  * UGens together, the difference being that a Summer 
  * can have more than one UGen patched to it and will 
  * output the sum of all signals, whereas most other UGens
  * allow only one input.
  * 
  * For many more examples of UGens included with Minim, 
  * have a look in the Synthesis folder of the Minim examples.
  * &lt;p>
  * For more information about Minim and additional features, 
  * visit http://code.compartmental.net/minim/
  */

import ddf.minim.*;
import ddf.minim.ugens.*;

Minim       minim;
AudioOutput out;

void setup()
{
  size(512, 200, P3D);
  
  minim = new Minim(this);
  
  // use the getLineOut method of the Minim object to get an AudioOutput object
  out = minim.getLineOut();
  
  Summer sum = new Summer();
  
  // create some Oscils to patch to the Summer
  Oscil wave = new Oscil( Frequency.ofPitch("A4"), 0.3f, Waves.SINE );
  // patch the Oscil to the Summer
  wave.patch( sum );
  
  wave = new Oscil( Frequency.ofPitch("C#5"), 0.3f, Waves.SINE );
  wave.patch( sum );
  
  wave = new Oscil( Frequency.ofPitch("E5"), 0.3f, Waves.SINE );
  wave.patch( sum );
  
  // and the Summer to the output and you should hear a major chord
  sum.patch( out );
}

void draw()
{
  background(0);
  stroke(255);
  strokeWeight(1);
  
  // draw the waveform of the output
  for(int i = 0; i &lt; out.bufferSize() - 1; i++)
  {
    line( i, 50  - out.left.get(i)*50,  i+1, 50  - out.left.get(i+1)*50 );
    line( i, 150 - out.right.get(i)*50, i+1, 150 - out.right.get(i+1)*50 );
  }
}
</pre>
    	<p class="memberSectionHeader">Usage</p>
    	Web & Application
    </td>
  </tr>
</table>
</center>
</body>
</html>